/**
 * 
 * @Name: layuiSimpleNews - 极简新闻资讯模板
 * @Author: star1029
 * @Copyright
 * 
 */

layui.define([ 'element', 'form', 'laypage', 'upload', 'carousel' ], function(exports) {
	var $ = layui.$, element = layui.element, form = layui.form, laypage = layui.laypage, carousel = layui.carousel;

	// 头部——点击切换
	$(document).on("click",".cms-header #switch",function() {
		var cmsHeader = $(this).closest(".cms-header");
		if (cmsHeader.find(".header-nav").hasClass("close")) {
			cmsHeader.find(".header-nav").removeClass("close");
		} else {
			cmsHeader.find(".header-nav").addClass("close");
		}
	})
	
	// 点赞
	$(document).on("click",".zan",function() {
		var articleId = $(this).attr("articleId");
		var self = this;
		 Common.post("/core/zan/zan.json", {aId:articleId}, function(count) {
            $(self).find("span").html(count);
         })
	})
	
	exports('api', {});
})